package com.lytoyo.neihanduanzi.model.index;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.CompletionField;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.core.suggest.Completion;

/**
 * Package:com.lytoyo.neihanduanzi.model.index
 *
 * @ClassName:SuggestIndex
 * @Create:2025/4/10 15:53
 **/
@Document(indexName = "suggest")
@JsonIgnoreProperties(ignoreUnknown = true)
@Accessors(chain = true)
@Data
public class SuggestIndex {
    @Id
    private String id;

    @Field(type = FieldType.Text,analyzer = "standard")
    private String title;

    @CompletionField(analyzer = "standard",searchAnalyzer = "standard",maxInputLength = 20)
    private Completion keyword;

    @CompletionField(analyzer = "standard",searchAnalyzer = "standard",maxInputLength = 20)
    private Completion keywordPinyin;

    @CompletionField(analyzer = "standard",searchAnalyzer = "standard",maxInputLength = 20)
    private Completion keywordSequence;
}
